BigDFT.Interop.NWChemInterop module

class NWChemCalculator(omp='1', mpi_run='', dry_run=False, skip=False, verbose=True)[source]

A calculator that drives NWChem calculations through the command line.

This calculator will look in the environment for the following variables: * OMP_NUM_THREADS : number of threads to use * NWCHEM_MPIRUN : the mpi command you want to launch nwchem with * NWCHEM_ROOT : the directory that contains the nwchem executable.

os = <module 'os' from '/usr/local/anaconda/lib/python3.7/os.py'>
pre_processing()[source]

Process local run dictionary to create the input directory and identify the command to be passed

Returns

dictionary containing the command to be passed to process_run()

Return type

dict

process_run(command)[source]

Run the NWChem executable.

post_processing(logname, command)[source]

Post processing the calculation.

Returns

a representation of the detailed output.

Return type

(BigDFT.Interop.NWChemInterop.NWChemLogfile)

class NWChemLogfile(logname)[source]

This class stores the values of the output generated by NWChem.

energy

the energy of the system

Type

float

nocca

number of occupied alpha orbitals

Type

int

noccb

number of occupied beta orbitals.

Type

int

get_tddft_roots()[source]

If you run a tddft calculation, this will extract information about the roots.

Returns

dictionary mapping singlets / triplets lists of roots.

Return type

(dict)

class NWBlock(title, values=None)[source]

NWChem input files are basically a list of blocks. A block has a title, and a value or list of values. The list of values can also be nothing.

title

the heading of the block being made.

Type

str

values

a list of entries in a given block.

Type

list/str

nwchem_geometry(sys)[source]

Create an NWBlock for a given geometry.

Parameters

sys (BigDFT.Systems.System) – the system being studied.

nwchem_basis(sys, bname=None, bdict=None, spherical=None)[source]

Create an NWBlock for a given basis set.

Parameters
  • sys (BigDFT.Systems.System) – the system.

  • bname (str) – the name of the basis set.

  • bdict (dict) – a dictionary mapping atoms to basis sets.

  • spherical (str) – spherical or cartesian. Default left to nwchem.

_example()[source]

The following is an example of module usage:

"""Example of using NWChem interoperability"""
from BigDFT.Database.Molecules import get_molecule

# Create a system.
sys = get_molecule("H2O")

# Create an input file
inp = []

# Create the Basis Set
inp.append(nwchem_basis(sys, "6-31G*"))

# Create the DFT Block
inp.append(NWBlock("dft",
           values=[NWBlock("XC", "PBE0"), "direct"]))
inp.append(NWBlock("task", "dft"))

# Create a calculator.
code = NWChemCalculator()
log = code.run(sys=sys, input=inp, name="test", run_dir="work")

print(log.energy)